import Vue from 'vue'
import Router from 'vue-router'

import Home from "@/page/home"
import Ad from "@/page/ad"
import Exact from "@/page/exact"

import Map from "@/page/map"
import Detail from "@/page/detail"
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: resolve=>require(["@/page/round"],resolve),
      meta: {
        keepAlive: true, // 需要被缓存,

      }
    },
    {
      path: '/test',
      name: 'home',
      component: resolve=>require(["@/page/test"],resolve),

    },
    {
      path: '/login',
      name: 'login',
      component: resolve=>require(["@/page/login"],resolve),
      meta: {
        title:"登录页"
      }
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      meta: {
        keepAlive: true, // 需要被缓存,
        requireLogin:true,
          title:"通讯录"

      }
    },
    {
      path: '/detail',
      name: 'detail',
      component: Detail
    },
    {
      path: '/ad',
      name: 'ad',
      component: Ad,
      meta: {
        requireLogin:true,
        title:"公告"
      }
    },
    {
      path: '/map',
      name: 'map',
      component: Map,
      meta: {
        keepAlive: true // 需要被缓存
      }
    },
    {
      path: '/exact',
      name: 'exact',
      component: Exact,
      meta: {
        requireLogin:true
      }
    },
    {
      path: '/round',
      name: 'round',
      component:resolve=>require(["@/page/round"],resolve),
      meta: {
        keepAlive: true // 需要被缓存
      }
    }
    ,
    {
      path: '/list',
      name: 'list',
      component:resolve=>require(["@/page/list"],resolve),
      meta:{
        title:"列表页面"
      }

    },
    {
      path: '*',
      name: '404',
      component:resolve=>require(["@/page/error"],resolve),
      meta:{
        title:"列表页面"
      }

    }
  ]
})
